/*
 * Copyright (c) 2015  3 7
 * ---11 :47:18
 * ---作者:吴培基
 * ---QQ:757671834
 */

package kali.wpj.kali.util;

import android.content.Context;

import com.loopj.android.http.AsyncHttpResponseHandler;
import com.marshalchen.common.commonUtils.urlUtils.HttpUtilsAsync;
import com.marshalchen.common.ui.ToastUtil;

import org.apache.http.Header;

import java.io.UnsupportedEncodingException;

/**
 * Created by wpj on 2015/3/7.
 */
public class getResultTools {
    private Context context;
    private String URLCENTER;
    private  void getResult(String Ip,String cmd,String serviceUrl){

        HttpUtilsAsync.get("http://" + Ip + serviceUrl + cmd, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int i, Header[] headers, byte[] bytes) {
                System.out.println("成功了" + bytes.toString());
                String str = null;
                try {
                    str = new String(bytes, "UTF-8");
                } catch (UnsupportedEncodingException e) {
                    e.printStackTrace();
                }
             //   txtview.setText(str);
            }

            @Override
            public void onFinish() {
             //   mDialog.dismiss();

            }

            @Override
            public void onStart() {
          //      showRoundProcessDialog(ScanActivity.this, R.layout.loading_process_dialog_anim);

            }

            @Override
            public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) {
                ToastUtil.show(context, "失败");
            }
        });




    }


    public void showRoundProcessDialog(Context mContext, int layout){
//        mDialog = new AlertDialog.Builder(mContext).create();
//        mDialog.setTitle("努力查询中...");
//        mDialog.show();
//        // 注意此处要放在show之后 否则会报异常
//        mDialog.setContentView(layout);
    }
}
